package abstracts;

public class Demo {
    public static void main(String[] args) {

    }
}

abstract class Animal {
    //共有属性
    String name;
    int age;

    //共有行为
    //若共有行为不好写方法体可以吧方法定义成抽象方法
    public abstract void eat();

}

class Dog extends Animal {

    //行为


    public void swim() {
        System.out.println("狗刨");
    }

    @Override
    public void eat() {
        System.out.println("狗吃骨头");

    }
}

class cat extends Animal {

    //行为

    public void catchMouse() {
        System.out.println("猫抓老鼠");
    }

    @Override
    public void eat() {
        System.out.println("猫吃罐头");

    }
}
